﻿using Church.Common;

namespace Church.Models.Shared
{
	public class PuzzleModel
	{
		#region Variables

		private string _description;
		private string _header;

		#endregion

		#region Properties

		public string Url { get; set; }

		public string ImageUrl { get; set; }

		public string Header
		{
			get
			{
				if (_header == null)
					_header = string.Empty;
				return _header.Length > 40
					? string.Concat(_header.Substring(0, 37), "...")
					: _header;
			}
			set
			{
				_header = value ?? string.Empty;
			}
		}

		public string Description
		{
			get
			{
				if (_description == null)
					_description = string.Empty;
				return _description.Length > 140
					? string.Concat(_description.Substring(0, 137), "...")
					: _description;
			}
			set
			{
				_description = value ?? string.Empty;
			}
		}

		#endregion

		#region Constructors

		public PuzzleModel()
		{
			Url = Constants.EMPTY_ANCHOR_LINK;
			ImageUrl = Constants.DEFAULT_PUZZLE_IMAGE_URL;
			Header = string.Empty;
			Description = string.Empty;
		}

		#endregion
	}
}